package sandbox.vaadin.skiller.entity;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import org.apache.log4j.Logger;

public class UnPopulator
{
	private final static Logger LOGGER = Logger.getLogger(UnPopulator.class);

	private EntityManager em;
	
	public UnPopulator(EntityManager em)
  {
	  super();
	  this.em = em;
  }

	public void unpopulate()
	{
		Query q;
		q = em.createNamedQuery("Skill_delete_all");
		LOGGER.debug("removed " + q.executeUpdate() + " skills");
		q = em.createNamedQuery("Skillgroup_delete_all");
		LOGGER.debug("removed " + q.executeUpdate() + " skillgroups");
	}
}